(in-package #:cl-cgie-test)

(fiveam:def-suite point-test-suite
  :description "test geo-point")

(fiveam:in-suite point-test-suite)

(fiveam:test test-point-add
  "test add two geo-point objects"
  (let ((point-1 (make-instance 'geometry-object:geo-point :point-x 1.0 :point-y 1.0 :point-z 1.0))
	(point-2 (make-instance 'geometry-object:geo-point :point-x 2.0 :point-y 2.0 :point-z 2.0))
	(point-3 (make-instance 'geometry-object:geo-point :point-x 3.0 :point-y 3.0 :point-z 3.0)))
    (fiveam:is (geometry-object:equal? (geometry-object:point-add point-1 point-2) point-3))))

(fiveam:test test-point-subtract
  "test subtract two geo-point objects"
  (let ((point-1 (make-instance 'geometry-object:geo-point :point-x 1.0 :point-y 1.0 :point-z 1.0))
	(point-2 (make-instance 'geometry-object:geo-point :point-x 2.0 :point-y 2.0 :point-z 2.0))
	(point-3 (make-instance 'geometry-object:geo-point :point-x 3.0 :point-y 3.0 :point-z 3.0)))
    (fiveam:is (geometry-object:equal? (geometry-object:point-subtract point-3 point-2) point-1))))

(fiveam:test test-point-scale
  "test scale a geo-point object"
  (let ((point-1 (make-instance 'geometry-object:geo-point :point-x 1.0 :point-y 1.0 :point-z 1.0))
	(point-3 (make-instance 'geometry-object:geo-point :point-x 3.0 :point-y 3.0 :point-z 3.0)))
    (fiveam:is (geometry-object:equal? (geometry-object:point-scale point-1 3.0) point-3))
    (fiveam:is (geometry-object:equal? (geometry-object:point-scale 3.0 point-1) point-3))))

(fiveam:run! '(test-point-add test-point-subtract test-point-scale))
